/**
 * Copyright (c) 2010-2011 julewa.com.  
 * All rights reserved. 
 * 
 * @author Huang Benhua
 * @date 2011-2-20
 * 
**/
package com.julewa;

import java.util.List;
import java.util.Set;

public interface Client {
	
	public boolean isAnonimous();
	//session
	public Object getSession(String key);
	public void setSession(String key, Object value);
	//
	public String getContentType();
	public void setContentType(String contentType);
	//
	public long generateIdentifier();
	//
	public void setUser(User user);
	public User getUser();
	//content type?
	public String getParameter(String key);
	public String[] getParameters(String key);
	public Set<String> getParameterNames();
	//request attr,得改个名字,否则容易误解
	public Object getRequest(String key);
	public void setRequest(String key, Object value);
	//
	public String getAddress();
	public String getHostname();
	public String getUriRoot();
	public String getRestString();
	//
	public String getMessage(String key);
	public List<String> getMessages();
	public String getError(String key);
	public List<String> getErrors();
	
	public void setMessage(String field, String message, Object...args);
	public void putMessage(String message, Object...args);
	public void setError(String field, String error, Object...args);
	public void putError(String error, Object...args);
	
	//
	public void setMessage(String field, String message);
	public void putMessage(String message);
	public void setError(String field, String error);
	public void putError(String error);
	//
	public boolean hasError();
	public boolean hasMessage();
}
